package com.example.activity;

import android.media.Image;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;

import com.example.Base.BasePersonActivity;
import com.example.administrator.olddoctor.R;

/**
 * 意见反馈
 */
public class FeedBackActivity extends BasePersonActivity implements TextWatcher , View.OnClickListener{

    private EditText message_editext;
    private EditText contact_information;
    private ImageView delete;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        init();

    }

    private void init() {
        setActionBar(getResources().getDrawable(R.mipmap.call_back), null,"意见反馈",null,null,"提交");
        message_editext = (EditText) findViewById(R.id.message_editext);
        contact_information = (EditText) findViewById(R.id.contact_information);
        delete = (ImageView) findViewById(R.id.delete);
        contact_information.addTextChangedListener(this);
        delete.setOnClickListener(this);
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
        if(charSequence.length()==0){
            delete.setVisibility(View.INVISIBLE);
        } else {
            delete.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void afterTextChanged(Editable s) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){

            case R.id.delete:
                contact_information.setText("");
                delete.setVisibility(View.INVISIBLE);
                break;
        }
    }
}
